package collention;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
public class NewForDemo {
    public static void main(String[] args) {
        String[] array={"1","2","3","5","6","4"};
        for(int i=0;i<array.length;i++){
            System.out.println(array[i]);
        }
        for(String str:array){
            System.out.println(str);
        }

        Collection C=new ArrayList();
        C.add("one");
        C.add("two");
        C.add("there");
        C.add("for");
        C.add("five");
        C.add("fix");
        C.add("seven");
        C.add("eight");
        Iterator it =C.iterator();
        while (it.hasNext()){
            String str=(String)it.next();
            System.out.println(str);
        }
        for(Object obj:C){
            String c=(String)(obj);
            System.out.println(c);

        }
    }
}
